home *** CD-ROM | disk | FTP | other *** search
-
- /*
-
- File: CAS_Error.c
-
- Contains: CASample error reporting routines
-
- Written by: Rick Badertscher
-
- Copyright © 1988-1995 Apple Computer, All rights reserved.
-
- Change History (most recent first):
-
- <0> 11/17/95 RB Created
- */
-
- #ifdef USE_CALIB
- #include "CALib.h"
- #endif
-
- #include "CAS_Error.h"
- #include "CAS_App.h"
- #include "CAS_Globals.h"
- #include "CAS_StringTools.h"
-
- //----------------------------------------------------------------------
- // Error_Dialog
-
- void Error_ReportOperationError(OSErr theErr)
- {
- Str32 errorString;
- Str32 errorNumString;
- WindowPtr frontWindow;
- short stringIndex;
-
-
- frontWindow = App_GetFrontDocWindow();
-
- // Get the modal focus
-
- #ifdef USE_CALIB
- if (gCALibExists)
- if (!CARequestModalFocus(frontWindow))
- return;
- #endif
-
- if ((theErr >= kCASErrBase) && (theErr <= kCASErrLast))
- {
- // Get the CASample error string
- stringIndex = theErr - kCAErrBase;
- GetIndString( errorString, kErrorStringRsrc, theErr );
- ParamText( errorString, nil, nil, nil );
-
- }
- else
- {
- // Not a CASample error, so show the error number
- sCopyStr ("\pUnknown", errorString);
- NumToString (theErr, errorNumString);
- ParamText( errorString, errorNumString, nil, nil );
-
- }
-
-
- // Display the error dialog
-
- Dialog_CenterALRTonFrontWindow( kOperationErrorDialog );
- StopAlert( kOperationErrorDialog, nil );
-
- // Relinquish the modal focus
-
- #ifdef USE_CALIB
- if (gCALibExists)
- CARelinquishModalFocus(frontWindow);
- #endif
- }
-
-
-
-
- void Error_ShowMessage( short msgIndex)
- {
- Str32 errorString;
- WindowPtr frontWindow;
-
-
- frontWindow = App_GetFrontDocWindow();
-
- // Get the modal focus
-
- #ifdef USE_CALIB
- if (gCALibExists)
- if (!CARequestModalFocus(frontWindow))
- return;
- #endif
-
- // Get the CASample error string
- GetIndString( errorString, kMessageStringRsrc, msgIndex );
-
- ParamText( errorString, nil, nil, nil );
-
- // Display the error dialog
-
- Dialog_CenterALRTonFrontWindow( kMessageDialog );
- StopAlert( kMessageDialog, nil );
-
- // Relinquish the modal focus
-
- #ifdef USE_CALIB
- if (gCALibExists)
- CARelinquishModalFocus(frontWindow);
- #endif
-
-
- }
-
-
-